<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">	<!-- 声明编码，防止中文乱码 -->
		<title>网页标题</title>
    <link rel="stylesheet" href="../css/BBK.css">

    <style>
      #title{
        color: red;
      }
      .t1{
        color: blue;
      }
    </style>
	</head>
  <body>
    <div class="container">
      <h1 id="title">登陆后用户名显示在这里</h1>

      <button type="button" onclick="login()">用户登陆</button>
      <br>
      <hr>
      <img class="img" src="../images/四轮.png" alt="">
    </div>
    <script src="../js/index.js"></script>
    <script>
      function login (){
        let url = 'http://127.0.0.1:8081/login?username=ss';//'http://127.0.0.1:8081/login?username=111';

        Ajax.get(url, function (res) {
          console.info(res)
          const dataget = JSON.parse(res)
          console.info(dataget)
          let el_title = document.getElementById('title');
          el_title.innerHTML = dataget.data.username;
          //el_title.innerHTML = dataget.data.username; 

        })
      }


    </script>
  </body>
</html>